#ifndef QDRIVEBAR_H
#define QDRIVEBAR_H

#include "../../lib/corelib/styledbar.h"

#include <QWidget>
#include <QTreeWidget>
#include <QStringListModel>
#include <QItemDelegate>

class QAbstractDrive;
class QActionToolBar;
class QDriveBar;

namespace Ui {
    class QDriveBar;
}

class DriveDelegate: public QItemDelegate
{
    Q_OBJECT
public:
    DriveDelegate(QDriveBar* bar):m_bar(bar){}
    void	paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
    QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
    QSize    sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
protected:
    QDriveBar   *m_bar;
};

class DriveHeadView: public QTreeWidget
{
    Q_OBJECT
public:
    DriveHeadView(QWidget *parent=0);
};


class QDriveBar : public StyledBar
{
    Q_OBJECT
public:
    explicit QDriveBar(QWidget *parent = 0);
    ~QDriveBar();

    void    setSelect(int index);
    int     current();

    void    addItem(const QString &text);
    void    removeItem(int index);
    void    clear();

protected slots:

    void    next();
    void    prev();

    void    sectionClicked(const QModelIndex & index);

    void    addDrive();
signals:
    void    select(int index);
    void    addWidget(int index);
    void    remove();
    void    addValue();
    void    removeSelectValue();
private:
    Ui::QDriveBar *ui;
    DriveHeadView  *m_headView;
    QActionToolBar  *m_toolBar;
    QTreeWidgetItem *m_item;
    int             m_current;
};

#endif // QDRIVEBAR_H
